/*****************************************************************
 * 开发公司或单位：μs.server l.t.d
 * 版权：本文件版权归属us公司研发中心 © 2010-2011
 * 所属项目：news4Desinger
 * 
 * @author 黄显宏
 * @since Jdk6
 * @date Jul 13, 2011
 *********************************************************************/

package com.monlyu.action.home;

import com.monlyu.action.BaseAction;
import com.monlyu.bo.BaseBo;
import com.monlyu.vo.Education;

public class EducateAction extends BaseAction {

    private Education education;
    private BaseBo baseBo;

    public void setBaseBo(BaseBo baseBo){
        this.baseBo = baseBo;
    }

    public Education getEducation(){
        return education;
    }

    public void setEducation(Education education){
        this.education = education;
    }

    @Override
    public String execute() throws Exception{
        if (education != null && education.getId() != null) {
            education.setId(1l);
        }
        baseBo.save(education);
        return ajax(education.getId());
    }

    public String toEdit(){
        if (education != null) {
            education = baseBo.get(Education.class, education.getId());
        }
        return view("educate.jsp");
    }

}
